/**
 * Selling Partner API for Orders
 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
 *
 * The version of the OpenAPI document: v0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'
import { ConfirmShipmentOrderItem } from './ConfirmShipmentOrderItem.js'

/**
 * The PackageDetail model module.
 * @module orders_v0/model/PackageDetail
 * @version v0
 */
export class PackageDetail {
  /**
   * Constructs a new <code>PackageDetail</code>.
   * Properties of packages
   * @alias module:orders_v0/model/PackageDetail
   * @class
   * @param packageReferenceId {String} A seller-supplied identifier that uniquely identifies a package within the scope of an order. Only positive numeric values are supported.
   * @param carrierCode {String} Identifies the carrier that will deliver the package. This field is required for all marketplaces. For more information, refer to the [`CarrierCode` announcement](https://developer-docs.amazon.com/sp-api/changelog/carriercode-value-required-in-shipment-confirmations-for-br-mx-ca-sg-au-in-jp-marketplaces).
   * @param trackingNumber {String} The tracking number used to obtain tracking and delivery information.
   * @param shipDate {Date} The shipping date for the package. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> date/time format.
   * @param orderItems {[ConfirmShipmentOrderItem]} A list of order items.
   */
  constructor (packageReferenceId, carrierCode, trackingNumber, shipDate, orderItems) {
    this.packageReferenceId = packageReferenceId
    this.carrierCode = carrierCode
    this.trackingNumber = trackingNumber
    this.shipDate = shipDate
    this.orderItems = orderItems
  }

  /**
   * Constructs a <code>PackageDetail</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {PackageDetail} obj Optional instance to populate.
   * @return {PackageDetail} The populated <code>PackageDetail</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new PackageDetail()
      if (data.hasOwnProperty('packageReferenceId')) { obj.packageReferenceId = ApiClient.convertToType(data.packageReferenceId, 'String') }
      if (data.hasOwnProperty('carrierCode')) { obj.carrierCode = ApiClient.convertToType(data.carrierCode, 'String') }
      if (data.hasOwnProperty('carrierName')) { obj.carrierName = ApiClient.convertToType(data.carrierName, 'String') }
      if (data.hasOwnProperty('shippingMethod')) { obj.shippingMethod = ApiClient.convertToType(data.shippingMethod, 'String') }
      if (data.hasOwnProperty('trackingNumber')) { obj.trackingNumber = ApiClient.convertToType(data.trackingNumber, 'String') }
      if (data.hasOwnProperty('shipDate')) { obj.shipDate = ApiClient.convertToType(data.shipDate, 'Date') }
      if (data.hasOwnProperty('shipFromSupplySourceId')) { obj.shipFromSupplySourceId = ApiClient.convertToType(data.shipFromSupplySourceId, 'String') }
      if (data.hasOwnProperty('orderItems')) { obj.orderItems = ApiClient.convertToType(data.orderItems, [ConfirmShipmentOrderItem]) }
    }
    return obj
  }
}

/**
 * A seller-supplied identifier that uniquely identifies a package within the scope of an order. Only positive numeric values are supported.
 * @member {String} packageReferenceId
 * @type {String}
 */
PackageDetail.prototype.packageReferenceId = undefined

/**
 * Identifies the carrier that will deliver the package. This field is required for all marketplaces. For more information, refer to the [`CarrierCode` announcement](https://developer-docs.amazon.com/sp-api/changelog/carriercode-value-required-in-shipment-confirmations-for-br-mx-ca-sg-au-in-jp-marketplaces).
 * @member {String} carrierCode
 * @type {String}
 */
PackageDetail.prototype.carrierCode = undefined

/**
 * Carrier name that will deliver the package. Required when `carrierCode` is \"Other\"
 * @member {String} carrierName
 * @type {String}
 */
PackageDetail.prototype.carrierName = undefined

/**
 * Ship method to be used for shipping the order.
 * @member {String} shippingMethod
 * @type {String}
 */
PackageDetail.prototype.shippingMethod = undefined

/**
 * The tracking number used to obtain tracking and delivery information.
 * @member {String} trackingNumber
 * @type {String}
 */
PackageDetail.prototype.trackingNumber = undefined

/**
 * The shipping date for the package. Must be in <a href='https://developer-docs.amazon.com/sp-api/docs/iso-8601'>ISO 8601</a> date/time format.
 * @member {Date} shipDate
 * @type {Date}
 */
PackageDetail.prototype.shipDate = undefined

/**
 * The unique identifier for the supply source.
 * @member {String} shipFromSupplySourceId
 * @type {String}
 */
PackageDetail.prototype.shipFromSupplySourceId = undefined

/**
 * A list of order items.
 * @member {[ConfirmShipmentOrderItem]} orderItems
 * @type {[ConfirmShipmentOrderItem]}
 */
PackageDetail.prototype.orderItems = undefined
